<?php
     $id=$_POST['id'];
	 $gid=$_POST['gid'];
     $name=$_POST['name'];
     $send_status=$_POST['send_status'];
	 $send_time=$_POST['send_time'];
	 $check_status=1;
	 $null_email=$_POST["null_email"];
	 //check_status的值应该与all_status的值是一样的
	 $email_title=$_POST['email_title'];
	 $g_title=$_POST['g_title'];
	 $g_author=$_POST['g_author'];
	 $g_web=$_POST['g_web']; 
	 $g_web2=implode(",",$g_web);
	 
	  if($send_status==1){
		 
		 $send_time=date('Y-m-d h:i:s',time());
		
	 }
	 
	 $connect=mysql_connect("localhost","root","192510");
	 mysql_select_db("news",$connect);
	 
	 if($id==null){//新建
		 $sql="insert into mygroup(name,send_status,send_time,check_status,g_title,g_author,g_web,email_title,null_email) value('$name','$send_status','$send_time','$check_status','$g_title','$g_author','$g_web2','$email_title','$null_email')";
		 mysql_query($sql);
	 }else{//更新
	 
	     $sql="update mygroup set name='$name',send_status='$send_status',send_time='$send_time',check_status='$check_status',g_title='$g_title',g_author='$g_author',g_web='$g_web2',null_email='$null_email',email_title='$email_title' where id='$id'";
	
	    mysql_query($sql);
	 
	 }
	
	 //查询数据
	// $sql2="select * from mygroup where name='".$name."'";
	// $result=mysql_query($sql2);
	// $row=mysql_fetch_assoc($result);
	// echo json_encode($row);
	 
	 //再跳到页面insert_group.php中
	// echo "<script>location='../select/select_group.php'</script>";
	 
	 
	 
?>